<div class="container">
  <h1>filter_name()</h1>
  <p class="signature"> function filter_name(string $name, array $allowed_chars = []): string </p>
  <h2>Description</h2>
  <div class="description">
    <p>Filters and sanitizes a name, typically used for usernames.</p>
  </div>
  <h2>Parameters</h2>
  <table>
    <thead>
      <tr>
        <th>Parameter</th>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>$name</td>
        <td>string</td>
        <td>The input name to be filtered and sanitized.</td>
      </tr>
      <tr>
        <td>$allowed_chars</td>
        <td>array</td>
        <td>Optional. An array of allowed characters.</td>
      </tr>
    </tbody>
  </table>
  <h2>Return Value</h2>
  <table>
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>string</td>
        <td>The filtered and sanitized name.</td>
      </tr>
    </tbody>
  </table>
  <h2>Example Usage</h2>
  <div class="example">
    <pre>
$input_name = '&lt;script&gt;alert("Hello");&lt;/script&gt;';
$allowed_chars = ['-', '_'];
echo filter_name($input_name, $allowed_chars);
// Output: 'alert("Hello");'</pre>
  </div>
</div>
